                <!-- table -->
				<div class="box">
					<!-- box / title -->
					<div class="title">
						<h5>
                            <?=$title;?>
                            <?php 
                                if(isset($account)): 
                                    print ' No.Rekening '.$account; 
                                    print ' Periode '.month_name($month);
                                    print ' '.$year;
                                endif; 
                             ?>
                            
                        </h5>
						<div class="search">
                        <?php  if($account!='-'):   ?>
                            <?=form_open('cashflow/bank/getDetailBankExport')?>
								<div class="input">
                                    <label class="search"><?=lang('export')?></label>
									<?=form_dropdown('export',config('export'))?>
								</div>
								<div class="button">
									<?=form_submit('submit',lang('export'))?>
								</div>
							<?=form_close()?>
                        <?php else:?>
                            <?=form_open('cashflow/bank/getDetailBank')?>
								<div class="input">
                                    <?=form_dropdown('month',config('month'),date('m'))?>
                                    <?=form_dropdown('year',config('year'),date('Y'))?>
								</div>
                                
                                <div class="input">
									<?=form_dropdown('account',$accounts,'','style="width:100px"')?>
								</div>
                                
								<div class="button">
									<input type="submit" name="submit" value="Search" />
								</div>
							<?=form_close()?>
                         <?php endif;?>   
						</div>
					</div>
					<!-- end box / title -->
					<div class="table">
                    
                        <?php if($this->session->flashdata('success')):?>
						<div id="message-success" class="message message-success">
							<div class="image">
								<img src="resources/images/icons/success.png" alt="Success" height="32" />
							</div>
							<div class="text">
								<h6>Send Email</h6>
								<span>Send Email Success to Recipient , to Edit email set to Settings Menu !</span>
							</div>
							<div class="dismiss">
									<a href="#message-success"></a>
							</div>
						</div>
						<?php elseif($this->session->flashdata('error')):?>
						<div id="message-error" class="message message-error">
								<div class="image">
									<img src="resources/images/icons/error.png" alt="Error" height="32" />
								</div>
								<div class="text">
									<h6>Send Email</h6>
									<span>Send Email Error to Recipient , to Edit email set to Settings Menu !</span>
								</div>
								<div class="dismiss">
									<a href="#message-error"></a>
								</div>
						</div>
						<?php endif;?>
                        
                        
                        <?php if($account!='-'): ?>
                        <div class="action">
                            <?=anchor('cashflow/bank/getDetailBankReset','Kembali Ke Awal');?>
			         	</div>
                        <?php endif;?>
                        
						<table>
							<thead>
								<tr>
									<th><?=lang('no')?></th>
                                    <th><?=lang('date')?></th>
                                    <th><?=lang('bm_no')?></th>
                                    <th><?=lang('bk_no')?></th>
                                    <th><?=lang('information')?></th>
                                    <th><?=lang('cheque_no')?></th>
                                    <th><?=lang('pic')?></th>
                                    <th><?=lang('dept')?></th>
                                    <th><?=lang('detail_credit')?></th>
                                    <th><?=lang('debet')?></th>
                                    <th><?=lang('credit')?></th>
                                    <th><?=lang('saldo')?></th>
								</tr>
							</thead>
                            
                            <tbody>
                            <?php 
                                $i=1;
                                $row = 0; 
                                if($account!='-') $balance = $saldo['Saldo']; else $balance=0;
                                $total_credit = 0;
                                $total_debet  = 0;
                                $saldo   = $balance;
                                foreach($bankbooks as $bank):?>
                                <?php 
                                    if($bank['NomorCek']!=""):
                                        $sql_sum  = $this->banks->getTotalBankBook($account,$month,$year,$bank['NomorCek']);
                                        $sql_data = $this->banks->sqlBankBook($month,$year,$account,'no',$bank['NomorCek']);
                                        $number   = $bank['NomorCek'];
                                    
                                    elseif($bank['NomorGiro']!=""):
                                        $sql_sum  = $this->banks->getTotalBankBook($account,$month,$year,'',$bank['NomorGiro']);
                                        $sql_data = $this->banks->sqlBankBook($month,$year,$account,'no','',$bank['NomorGiro']);
                                        $number   = $bank['NomorGiro'];
                                    
                                    elseif($bank['NomorSurat']!=""):
                                        $sql_sum  = $this->banks->getTotalBankBook($account,$month,$year,'','',$bank['NomorSurat']);
                                        $sql_data = $this->banks->sqlBankBook($month,$year,$account,'no','','',$bank['NomorSurat']);
                                        $number   = $bank['NomorSurat']; 
                                    
                                    elseif($bank['NomorBM']!=""):
                                        $sql_sum  = $this->banks->getTotalBankBook($account,$month,$year,'','','',$bank['NomorBM']);
                                        $sql_data = $this->banks->sqlBankBook($month,$year,$account,'no','','','',$bank['NomorBM']);
                                        $number   = "";
                                    
                                    elseif($bank['NomorBK']!=""):
                                        $sql_sum  = $this->banks->getTotalBankBook($account,$month,$year,'','','','',$bank['NomorBK']);
                                        $sql_data = $this->banks->sqlBankBook($month,$year,$account,'','','','','',$bank['NomorBK']);
                                        $number   = "";             
                                    endif;
                                    
                                    $value       = $sql_data->result_array();
                                    $credit      = $sql_sum['total_credit'];  
                        			$debet       = $sql_sum['total_debet'];  
                        			$total_data  = $sql_sum['total_data']; 
                                    $total_credit= $total_credit + $credit; 
                                    $total_debet = $total_debet + $debet;           
                                ?>
                                <?php 
                                $j=1;
                                foreach($value as $val):
                                    
                                    if($j==1)
                					   $no = $number;
                				    else
                					   $no = ""; 
                                       
                                    if($j==$total_data):
                					   $pay   = decimal($credit,2);					
                                       $saldo = ($saldo + $val['Debet']) - $credit;						
                				    else:
                					   $pay   = "";					 
                					   $saldo = ($saldo + $val['Debet']);
                                    endif;  
                                    					
                                ?>
                                
                                <?php if($row==0):?>
                                    <tr style="width:100%;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td><?=decimal($balance,2)?></td>
                                    </tr>
                                <?php $row++; ?>   
                                <?php endif; ?>
                                
                                <tr style="width:100%;">
                                    <td><?=$i;?></td>
                                    <td><?=indonesian_date($bank['Tanggal']);?></td>
                                    <td><?=$val['NomorBM'];?></td>
                                    <td><?=$val['NomorBK'];?></td>
                                    <td><p><?=$val['Uraian'];?></p></td>
                                    <td><?=$no;?></td>
                                    <td><?=$val['PIC'];?></td>
                                    <td><?=$val['DeptId'];?></td>
                                    <td><?=decimal($val['Credit'],2);?></td>
                                    <td><?=decimal($val['Debet'],2);?></td>
                                    <td><?=$pay?></td>
                                    <td><?=decimal($saldo,2)?></td>
                                </tr>
                                <?php 
                                $i++;
                                $j++;
                                endforeach;?>
                             <?php 
                                endforeach; ?>   
                            </tbody>
                            
                            <tfoot>
                                <tr>
                    				<th colspan='8' class="center"><strong><?='Total No Rekening '.$account ?></strong></td>
                    				<th class="right"><strong>&nbsp;&nbsp;<?=decimal($balance,2)?></strong></td>
                    				<th class="right"><strong>&nbsp;&nbsp;<?=decimal($total_debet,2)?></strong></td>
                    				<th class="right"><strong>&nbsp;&nbsp;<?=decimal($total_credit,2)?></strong></td>
                    				<th class="right"><strong>&nbsp;&nbsp;<?=decimal($saldo,2)?></strong></td>
                    			</tr>
                            </tfoot>
							
						</table>
                        
                       <?php if($account!='-'):?>
                        <div class="action">
                            <?=anchor('cashflow/bank/getDetailBankReset','Kembali Ke Awal');?>
			         	</div>
                        <?php endif;?>
                        
					</div>
				</div>
				<!-- end table -->